package com.ghpt.controller;

import com.ghpt.pojo.DianCN;
import com.ghpt.service.DianCNService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/diancn")
public class DianCNController {
    private final DianCNService dianCNService;

    public DianCNController(DianCNService dianCNService) {
        this.dianCNService = dianCNService;
    }
    @GetMapping("/{id}")
    public DianCN getDianCNById(@PathVariable Long id) {
        System.out.println("结果是"+dianCNService.findDianCNById(id));
        return dianCNService.findDianCNById(id);
    }
    @PutMapping
    public int updateDianCN(@RequestBody DianCN dianCN) {
        return dianCNService.updateById(dianCN);
    }

}
